using System.Collections.Generic;
using GameFramework;
using UnityEngine;
using UnityGameFramework.Runtime;

namespace StarForce
{
    /// <summary>
    /// 游戏工具类
    /// </summary>
    public static class GameUtility
    {
        /// <summary>
        /// 同一行生成两个地板的概率
        /// </summary>
        private static readonly double m_CreateDoubleRandom = 0.5;
        
        private static List<string> m_PropImage=new List<string>()
        {
            "Assets/GameMain/Sprites/Spring.png",  
            "Assets/GameMain/Sprites/Devil.png",
            "Assets/GameMain/Sprites/Seccotine.png",
        };

        public static void CreateNormalGround(GroundDataList groundDataList, GroundType type,bool hasProp)
        {
            CreateNormalGround(groundDataList, (int) type,(int) type,hasProp);
        }

        public static void CreateComposeGround(GroundDataList groundDataList, GroundType type, GroundType type2,bool hasProp)
        {
            CreateNormalGround(groundDataList, (int) type,(int) type2,hasProp);
        }

        public static void CreateNormalGround(GroundDataList groundDataList,int type,int type2,bool hasProp)
        {
            double random = Utility.Random.GetRandomDouble();
            float 
            x = Random.Range(-2f,2f);
            groundDataList.Add(x,type,hasProp);
            if (random < m_CreateDoubleRandom)
            {
                float x2 = Random.Range(1f, 2f);
                if (x>0)
                {
                    groundDataList.Add(-x2,type2,hasProp);
                }
                else
                {
                    groundDataList.Add(x2,type2,hasProp);
                }
            }
        }

        public static string GetPropImageByType(int type)
        {
            return m_PropImage[type];
        }
    }
}